package org.mspring.mlog.utils;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * @author Gao Youbo
 * @since 2012-7-23
 */
public class WebUtils extends org.springframework.web.util.WebUtils {

    public static final HttpServletRequest getRequest() {
        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    }

    /**
     * 获取对应文件系统的路径
     *
     * @param path
     * @return
     */
    public static final String getRealPath() {
        return System.getProperty("realPath");
    }

    /**
     * 获取当前的contextpath
     *
     * @return
     */
    public static final String getContextPath() {
        return System.getProperty("contextPath");
    }

}
